import java.util.*;

public class Solution884 {
    public String[] uncommonFromSentences(String s1, String s2) {
        String[] t1=s1.split(" ");
        Map<String,Integer> map1=new HashMap<>();
        for (String s : t1) {
            map1.put(s,map1.getOrDefault(s,0)+1);
        }
        String[] t2=s2.split(" ");
        Map<String,Integer> map2=new HashMap<>();
        for (String s : t2) {
            map2.put(s,map2.getOrDefault(s,0)+1);
        }
        List<String> ans=new ArrayList<>();
        for (Map.Entry<String, Integer> entry : map1.entrySet()) {
            if (entry.getValue()==1 && !map2.containsKey(entry.getKey())){
                ans.add(entry.getKey());
            }
        }
        for (Map.Entry<String, Integer> entry : map2.entrySet()) {
            if (entry.getValue()==1 && !map1.containsKey(entry.getKey())){
                ans.add(entry.getKey());
            }
        }
        String[] a=new String[ans.size()];
        for (int i=0;i<ans.size();i++){
            a[i]=ans.get(i);
        }
        return a;
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Solution884().uncommonFromSentences("this apple is sweet","this apple is sour")));
    }
}
